
using Castle.ActiveRecord;
using System;
using System.Collections.Generic;

namespace IronMis2.Models
{
    [ActiveRecord("payout",Schema="dbo")]
    public class Payout : ActiveRecordBase<Payout>
    {
        private Guid id;
        private string payoutid;
        private string payoutAccount;
        private string payoutRemark;
        private decimal payoutTotal;
        private Department deparment;
        private Employee employee ;
        private DateTime payoutDate;
        private IList<Item> items;

        [Property(Column="payout_id",SqlType="char",Length=10)]
        public string Payoutid
        {
            set { payoutid = value; }
            get { return payoutid; }
        }
        
        [Property(Column="payout_account",SqlType="char",Length=19)]
        public string PayoutAccount
        {
            set { payoutAccount=value;}
            get { return payoutAccount;}
        }
       
        [Property(Column = "payout_remark", SqlType = "varchar", Length = 50)]
        public string PayoutRemark
        {
            set { payoutRemark = value; }
            get { return payoutRemark; }
        }
        
        [Property(Column = "payout_total", SqlType = "decimal", Length = 9)]
        public decimal PayoutTotal
        {
            set { payoutTotal = value; }
            get { return payoutTotal; }
        }

        [Property(Column = "payout_date", SqlType = "datetime", Length = 8,NotNull = true)]
        public DateTime PayoutDate
        {
            set { payoutDate = value; }
            get { return payoutDate; }
        }

        [BelongsTo(Column="dep_id",ForeignKey="id",Insert=true,Update=true,Fetch=FetchEnum.Select)]
        public Department Department
        {
            set { deparment = value; }
            get { return deparment; }
        }

        [BelongsTo(Column = "emp_id", ForeignKey = "id", Insert=true,Update=true,Fetch = FetchEnum.Select)]
        public Employee Employee
        {
            set { employee = value; }
            get { return employee; }
        }

        [PrimaryKey(PrimaryKeyType.GuidComb,Column="id")]
        public Guid Id
        {
            set { id = value; }
            get { return id; }
        }

        [HasMany(Lazy = true, Inverse = true, Cascade = ManyRelationCascadeEnum.All)]
        public IList<Item> Items
        {
            set { items = value; }
            get { return items; }
        }
    }
}
